<template>
    <div class="attachFile">
        <a-tag v-for="(item,index) in fileList" :key="index">
            {{item.filename}}<a-icon type="close" @click="deleteFile(index)" />
        </a-tag>
        <uploadFile 
            name="上传附件"
            @returnFileUrl="returnFileUrl"
        ></uploadFile>
    </div>
</template>
<script>
import uploadFile from "@/components/common/uploadFile"
export default {
    name:"attachFile",
    components:{uploadFile},
    props:{
        fileList:Array,
    },
    watch:{
        fileList:function(val){
            this.$emit('getFileUrl',val)
        }
    },
    methods:{
        deleteFile(data){
            this.fileList.splice(data,1)
        },
        returnFileUrl(data){
            data.data.docUrl.forEach(item=>{
                this.fileList.push(item)
            })
        },
    }
}
</script>